﻿using System;
using System.Collections.Generic;

using System.Text;
using RebellionII.GameObjects;

namespace RebellionII.GameObjects.Units.Instances
{
    public class UnitInstance
    {
        public static int lastIDAssigned = 0;

        public int iUniqueID;
        public int iReferenceID;
        public State eCurrentState;
        public int iExperience;

        public int GetReferenceID
        {
            get { return iReferenceID; }
        }

        public int GetInstanceID
        {
            get { return iUniqueID; }
        }

        public UnitInstance()
        {
            iUniqueID = lastIDAssigned;
            lastIDAssigned++;
        }

        public UnitInstance(int referenceID, int instanceID)
        {
            iUniqueID = instanceID;
            iReferenceID = referenceID;
        }

        public UnitInstance(BaseUnit item)
        {
            iReferenceID = item.iUniqueID;
            eCurrentState = State.Normal;
            iExperience = 0;
        }

        public UnitInstance(int GUID)
        {
            iUniqueID = lastIDAssigned;
            iReferenceID = GUID;
            lastIDAssigned++;
        }

        public UnitInstance(BaseUnit tempUnit, State temp)
        {
            if (tempUnit is CapitalShip)
            {
                throw new NotSupportedException("Do not call UnitInstance with a CapitalShip. Use CapShipInstance");
            }
            eCurrentState = temp;
            iReferenceID = tempUnit.iUniqueID;
        }

        public int Experience
        {
            get { return iExperience; }
            set { iExperience = value; }
        }

        
    }
}
